package twel.probenprophet.domain.rules.magic.decorators;

import twel.probenprophet.domain.rules.magic.CastableSpell;

public class SpellWithShortenedCastTime extends SpontaneousModificationDecorator {

	public SpellWithShortenedCastTime(CastableSpell decorated) {
		super(decorated);
	}

	public SpellWithShortenedCastTime(CastableSpell decorated, int times) {
		super(decorated, times);
	}

	@Override
	public int getCastTime() {
		int originalCastTime = getDecorated().getCastTime();
		float divisor = 2f * getTimes();
		float calculatedCastTime = originalCastTime / divisor;
		int roundedCastTime = Math.round(calculatedCastTime);

		return Math.max(roundedCastTime, 1);
	}

	@Override
	protected Integer getSpellSkillModifier() {
		return 5;
	}
}
